package cn.iocoder.yudao.module.wecom.dal.mysql.momentlog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wecom.dal.dataobject.momentlog.MomentLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wecom.controller.admin.momentlog.vo.*;

/**
 * 朋友圈记录 Mapper
 *
 * @author 数创万维
 */
@Mapper
public interface MomentLogMapper extends BaseMapperX<MomentLogDO> {

    default PageResult<MomentLogDO> selectPage(MomentLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MomentLogDO>()
                .eqIfPresent(MomentLogDO::getJobType, reqVO.getJobType())
                .eqIfPresent(MomentLogDO::getToUserList, reqVO.getToUserList())
                .eqIfPresent(MomentLogDO::getSender, reqVO.getSender())
                .eqIfPresent(MomentLogDO::getContent, reqVO.getContent())
                .eqIfPresent(MomentLogDO::getJobid, reqVO.getJobid())
                .eqIfPresent(MomentLogDO::getAttachmentType, reqVO.getAttachmentType())
                .eqIfPresent(MomentLogDO::getImgUrl, reqVO.getImgUrl())
                .eqIfPresent(MomentLogDO::getLinkTitle, reqVO.getLinkTitle())
                .eqIfPresent(MomentLogDO::getLinkDesc, reqVO.getLinkDesc())
                .eqIfPresent(MomentLogDO::getLinkPicUrl, reqVO.getLinkPicUrl())
                .eqIfPresent(MomentLogDO::getLinkUrl, reqVO.getLinkUrl())
                .betweenIfPresent(MomentLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MomentLogDO::getId));
    }

}